import ctypes
# go build -buildmode=c-shared -o sum.so main.go
# 生成动态链接库
lib = ctypes.CDLL('./sum.so')
lib.Sum.argtypes = [ctypes.c_int64,ctypes.c_int64]
lib.Sum.restype = ctypes.c_int64
print(lib.Sum(1, 11))

# 比较效率
lib = ctypes.CDLL('./test.so')
print(lib.Sum(1,2,))
l = [1,2,3,4,5,6]
lib.sum2.argtypes = [ctypes.c_int * len(l)]
l = (ctypes.c_int * len(l))(*l)
print(lib.sum2(l))